package login

import (
	"061/Sgame/db"
	"061/Sgame/net"
	"061/Sgame/server/game/model/data"
	"061/Sgame/server/login/controller"
	"061/Sgame/server/login/model"
	"061/Sgame/server/models"
	"fmt"
)

var Router = net.NewRouter()

func Init() {
	//还有别的初始化方法
	//初始化数据库
	db.TestDB()
	MigrateTable()
	InitRouter()
}
func InitRouter() {
	controller.DefaultAccount.Router(Router)
}
func MigrateTable() {
	err := db.GormDB.AutoMigrate(
		data.Role{}, data.RoleRes{}, model.LoginHistory{}, model.LoginLast{}, models.User{},
		data.RoleAttribute{}, data.MapRoleCity{}, data.MapRoleBuild{}, data.General{}, data.Army{},
		data.WarReport{}, data.Skill{}, data.CityFacility{}, data.CoalitionApply{}, data.Coalition{},
		data.CoalitionLog{},
	)
	if err != nil {
		fmt.Println("迁移表失败。。。", err)
		return
	}
}
